﻿using System;
using SharpKit.JavaScript;

namespace SharpKit.Onx.Playground.Recipes
{
    [JsType(JsMode.Global, Filename = "../res/TurnWazeOnWhenDrivingAndCharging.js")]
    public class TurnWazeOnWhenDrivingAndCharging : OnxContextBase
    {
        [JsMethod(GlobalCode = true)]
        static void Configure()
        {
            Device.ModeOfTransport.Changed += (signal) =>
            {
                if (signal.Current == ModeOfTransportType.Driving && Device.Battery.Status.IsCharging)
                {
                    Device.Applications.Launch("Waze");
                }
            };
        }
    }
}